<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="/res/back/css/base.css" rel="stylesheet" type="text/css" />
    <link href="/res/third/bootstrap3/css/bootstrap-select.css" rel="stylesheet" type="text/css" />
    <link href="/res/third/bootstrap3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="panel panel-info panel-content">
    <div class="panel-heading">
        <form id="soform" method="post" >
            <table>
                <tr>
                    <td class="w120">
                        <select class="form-control"  id="ordertype" name="ordertype" onchange="switchOrderType()">
                            <option value="1" [#if ordertype == '1']selected[/#if]>商城订单</option>
                            <option value="2" [#if ordertype == '2']selected[/#if]>询价订单</option>
                        </select>
                    </td>
                    <td class="w80">
                        <label for="companyName" class="center-block">买家：</label>
                    </td>
                    <td class="w120">
                        <input type="text" class="form-control" id="buyerCompanyName" name="buyerCompanyName" value="${buyerCompanyName!}" placeholder="买家名称">
                    </td>
                    <td class="w80">
                        <label for="companyName" class="center-block">卖家：</label>
                    </td>
                    <td class="w120">
                        <input type="text" class="form-control" id="sellerCompanyName" name="sellerCompanyName" value="${sellerCompanyName!}" placeholder="卖家名称">
                    </td>
                    <td class="w80">
                        <label  for="state" class="center-block">交易状态：</label>
                    </td>
                    <td class="w120">
                        <select class="form-control"  id="state" name="state">
                            <option value="">全部</option>
                            [#list orderStateMap?keys as orderStateValue ]
                                <option value="${orderStateValue}" [#if state?? && state == orderStateValue]selected[/#if]>${orderStateMap[orderStateValue]}</option>
                            [/#list]
                        </select>
                    </td>
                    <td class="w80">
                        <label class="center-block">订单时间：</label>
                    </td>
                    <td class="w220">
                        <input class="Wdate" name="sdate" id="sdate" value="${sdate!}"  style="width:100px;" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'edate\')}'})"  > -
                        <input class="Wdate" name="edate" id="edate" value="${edate!}"  style="width:100px;" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'sdate\')}'})" >
                    </td>
                    <td>
                        <div class="input-group">
                            <input type="text" class="form-control"  name="keyword"  value="${keyword!}" placeholder="订单编号">
                            <span class="input-group-btn">
							<button class="btn btn-default" type="button" onclick="sosuo()">搜索</button>
						</span>
                        </div>
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <table class="table table-hover table-bordered table-striped table-condensed">
        <thead>
            <tr>
                <th>订单编号</th>
                [#if ordertype == '2']
                <th>项目</th>
                [/#if]
                <th>买家</th>
                <th>卖家</th>
                <th>订单金额</th>
                <th>订单状态</th>
                <th>订单时间</th>
                <th>操作</th>
            </tr>
        </thead>
    [#list pagination.list as order]
        <tr>
            <td>${order.orderNumber!}</td>
            [#if ordertype == '2']
            <td>${order.projectName!}</td>
            [/#if]
            <td>${order.buyerCompanyName!}</td>
            <td>${order.sellerCompanyName!}</td>
            <td>${order.totalPrice!}</td>
            <td>${orderStateMap[order.state?string]!}</td>
            <td>${order.ordertime!}</td>
            <td>
                <button class="btn btn-info btn-xs" onclick="detail(${order.id})">详情</button>
                [#if o_orderManage?? && o_orderManage=='1']
                [#else]
                [#if order.unAuditCount > 0]
                <button class="btn btn-info btn-xs" onclick="showAuditWin(${order.id})">审核</button>
                [/#if]
                [/#if]
            </td>
        </tr>
    [/#list]
    </table>

    <div class="panel-footer">[@fenye p = pagination form = 'infoForm' /]</div>
</div>

<script src="/res/common/js/jquery.1.9.1.min.js" type="text/javascript"></script>
<script src="/res/third/bootstrap3/bootstrap.min.js" type="text/javascript"></script>
<script src="/res/third/bootstrap3/bootstrap-select.js" type="text/javascript"></script>
<script src="/res/third/artDialog/jquery.artDialog.js" type="text/javascript"></script>
<script src="/res/third/validate/jquery.validate.js" type="text/javascript"></script>
<script src="/res/third/layer/layer.js"></script>
<script src="/res/third/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    var dialog;
    function sosuo(){
        var lpath =location.pathname;
        var pageNo = 1;
        $("#soform").attr("action",lpath+"?pageNo="+pageNo);
        $("#soform").submit();
    }

    function detail(orderId) {
        top.addTab("订单详情", "/order/order_detail.do?orderId=" + orderId);
    }

    function showAuditWin(orderId) {
        dialog = art.dialog.load("审批","/order/audit_list.do",{orderId:orderId});
    }

    function switchOrderType() {
        location.href = '/order/order_list.do?ordertype=' + $('#ordertype').val();
    }
</script>
</body>
</html>